#!/usr/bin/perl -w

##HACKABOT_HELP##
# Hacker Handle Generator
# !hacker some name
##HACKABOT_HELP##

use strict;
use URI::Escape;
use HTML::Entities;
use Hackabot::Client;

my $hbc = Hackabot::Client->new;
my $msg = $hbc->readline;
my $nick = $hbc->sent_by;

if (not $msg) {
    $msg = $nick;
}

$msg =~ s/\s*$//;
$msg = uri_escape($msg);
my $hacker = `curl -s -d "name=$msg" http://www.rootcompromise.org/hhg/ | grep filter:glow | sed -e 's/<[^>]*>//g' -e 's/^ *//g'`;
chomp $hacker;

$hacker = decode_entities($hacker);

print "send $nick: $hacker";
